//
//  KKChatDetailViewController+Datasource.m
//  ReplyAssistant
//
//  Created by liaozhenming on 2018/11/21.
//  Copyright © 2018 KK. All rights reserved.
//

#import "KKChatDetailViewController+Datasource.h"

#import "KKMessageItem.h"

@implementation KKChatDetailViewController (Datasource)


#pragma mark - UITableViewDatasource methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1
    ;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.arr_msgItems.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    KKMessageItem *messageItem = [self.arr_msgItems objectAtIndex: indexPath.row];
    return [messageItem heightInWidth: SCREEN_WIDTH style: KKChatMsgBaseTableViewCellStyle_C2C];
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    KKMessageItem *messageItem = [self.arr_msgItems objectAtIndex: indexPath.row];
    KKChatMsgBaseTableViewCell *cell = [messageItem tableView: tableView style: KKChatMsgBaseTableViewCellStyle_C2C];
    [cell configWithMsg: messageItem];
    return cell;
}

@end
